import request from './request'

// 获取可用支付方式
export function getPaymentMethods() {
  return request({
    url: '/payments/methods',
    method: 'get'
  })
}

// 创建支付记录
export function createPayment(data: {
  orderID: number;
  amount: number;
  paymentMethod: string;
  isPaid?: boolean;
}) {
  return request({
    url: '/payments',
    method: 'post',
    data
  })
}

// 获取订单的支付记录
export function getOrderPayments(orderId: string) {
  return request({
    url: `/payments/order/${orderId}`,
    method: 'get'
  })
}

// 标记支付完成
export function markPaymentAsPaid(id: string) {
  return request({
    url: `/payments/${id}/mark-paid`,
    method: 'patch'
  })
}

// 获取支付详情
export function getPaymentDetail(id: string) {
  return request({
    url: `/payments/${id}`,
    method: 'get'
  })
} 